import * as actionType from './constants.js';
import { reqsort } from '@/api/index'

export const changeSortData = (data) => {
    console.log("进去成功...............");
    return {
        type: actionType.CHANGE_SORTDATA,
        data: data
    }
}

export const setIndex = (data) => {
    // console.log("进去成功...............");
    return {
        type: actionType.SET_INDEX,
        data: data
    }
}

export const getSortData = () => {
    return (dispatch) => {
        reqsort()
            .then((res) => {
                console.log(res, '????///////////////////')
                dispatch(changeSortData(res.data.data))
            })
            .catch((e) => {
                console.log('出错了')
            })
    }
    // api

    // dispatch 同步骤 action
}